How-to get Doors command line parameters in DXL ?

Hi,
I need to get the command line switches in DXL.
Is there a solution ?

Thanks
Christophe
chmari - Tue Jul 10 03:11:30 EDT 2012

Re: How-to get Doors command line parameters in DXL ?
Mathias Mamsch - Tue Jul 10 04:44:33 EDT 2012

Which ones? The user password? ;-) There is a good reason, to not have the DXL script query ALL commandline parameters of DOORS. Otherwise a bad trigger could snoop user passwords for those people that have a startlink with their password in place. But on the other hand a bad trigger could do other worse stuff, so why worry ...

Anyway. You can get the addins / projectaddins / layoutaddins / ... directory settings from the commandline by using:
 

string s1 = getenv "DOORSADDINS" 
string s2 = getenv "DOORSPROJECTADDINS" 
string s3 = getenv "DOORSLAYOUTADDINS"

 


Using getenv you can also get other interesing stuff, like database location, doors home, etc. What parameters are you interested in? You could use a bad hack to get a pointer to the real commandline, but depending on what you try to you should probably not do so, unless necessary.

Regards, Mathias

 

 


Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

 

Re: How-to get Doors command line parameters in DXL ?
chmari - Tue Jul 10 04:59:40 EDT 2012

Mathias Mamsch - Tue Jul 10 04:44:33 EDT 2012

Which ones? The user password? ;-) There is a good reason, to not have the DXL script query ALL commandline parameters of DOORS. Otherwise a bad trigger could snoop user passwords for those people that have a startlink with their password in place. But on the other hand a bad trigger could do other worse stuff, so why worry ...

Anyway. You can get the addins / projectaddins / layoutaddins / ... directory settings from the commandline by using:
 

string s1 = getenv "DOORSADDINS" 
string s2 = getenv "DOORSPROJECTADDINS" 
string s3 = getenv "DOORSLAYOUTADDINS"

 


Using getenv you can also get other interesing stuff, like database location, doors home, etc. What parameters are you interested in? You could use a bad hack to get a pointer to the real commandline, but depending on what you try to you should probably not do so, unless necessary.

Regards, Mathias

 

 


Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

 

Thanks for your answer.
Effectively, I don't need to get user or password ;-) (but if Doors crashes, the Doors report displays these)
And for the -defopenmode options, there is a solution ?

Christophe

Re: How-to get Doors command line parameters in DXL ?
Mathias Mamsch - Tue Jul 10 08:14:49 EDT 2012

chmari - Tue Jul 10 04:59:40 EDT 2012
Thanks for your answer.
Effectively, I don't need to get user or password ;-) (but if Doors crashes, the Doors report displays these)
And for the -defopenmode options, there is a solution ?

Christophe

Argh, I should have known it. These all work:
 

print (getenv "DOORSDEFOPENMODE") "\n"
print (getenv "DOORSUSER") "\n"
print (getenv "DOORSPASSWORD") "\n"  // bad trigger, here we go!

 


LoL. Regards, Mathias

 

 


Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

 

Re: How-to get Doors command line parameters in DXL ?
Mathias Mamsch - Tue Jul 10 08:44:47 EDT 2012

Mathias Mamsch - Tue Jul 10 08:14:49 EDT 2012

Argh, I should have known it. These all work:
 

print (getenv "DOORSDEFOPENMODE") "\n"
print (getenv "DOORSUSER") "\n"
print (getenv "DOORSPASSWORD") "\n"  // bad trigger, here we go!

 


LoL. Regards, Mathias

 

 


Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

 

Wow, that works even under batch mode. So I guess I will put that on the list of the 100 ways to annoy DOORS administrators. If a company has any DXL batch script, that will run regularly as Administrator, and queries any non-system Module or Object Attribute, then the danger is that somebody puts a BadModule in the database, which instead of this attribute contains a DXL attribute with the following code:

if (isBatch) { 
   string sUser = getenv "DOORSUSER" 
   stirng sPw   = getenv "DOORSPASSWORD" 
   if (sUser == "Administrator") {
      print "Gotcha!" 
      sendEMailMessage(...)
   }
}

 


So before you query any non-system attribute from a batch script, you might want to make sure that this is not a DXL attribute and one always needs to run those scripts with --notriggers in place.

Regards, Mathias

 

 


Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

 

Re: How-to get Doors command line parameters in DXL ?
llandale - Tue Jul 10 10:53:27 EDT 2012

You cannot cycle through the switches:
-for each command line switch print name and value
If you want to see if certain command line switches are used I think you can do this:
  • string ValueReg = getenv("addins")
  • string ValueCmd = getenv("DOORSADDINS") // must be all upper case
  • if (ValueReg != ValueCmd) then "addins" is a command line switch

-Louie

Re: How-to get Doors command line parameters in DXL ?
llandale - Tue Jul 10 10:58:06 EDT 2012

Mathias Mamsch - Tue Jul 10 08:44:47 EDT 2012

Wow, that works even under batch mode. So I guess I will put that on the list of the 100 ways to annoy DOORS administrators. If a company has any DXL batch script, that will run regularly as Administrator, and queries any non-system Module or Object Attribute, then the danger is that somebody puts a BadModule in the database, which instead of this attribute contains a DXL attribute with the following code:

if (isBatch) { 
   string sUser = getenv "DOORSUSER" 
   stirng sPw   = getenv "DOORSPASSWORD" 
   if (sUser == "Administrator") {
      print "Gotcha!" 
      sendEMailMessage(...)
   }
}

 


So before you query any non-system attribute from a batch script, you might want to make sure that this is not a DXL attribute and one always needs to run those scripts with --notriggers in place.

Regards, Mathias

 

 


Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

 

I wonder if your batch job should then use this switch:
  • cli "setenv(\"DOORSPASSWORD\", \"Curses to anybody reading this.\")"

-Louie

Re: How-to get Doors command line parameters in DXL ?
Mathias Mamsch - Tue Jul 10 20:21:09 EDT 2012

llandale - Tue Jul 10 10:58:06 EDT 2012
I wonder if your batch job should then use this switch:

  • cli "setenv(\"DOORSPASSWORD\", \"Curses to anybody reading this.\")"

-Louie

Good idea. Just tried it, unfortunately it does not work. DOORS will prefer commandline switches over registry settings (which is, where setenv writes the string). Run this from batch:
 

setenv ("DOORSPASSWORD", "Curse Words")
print "password:" (getenv("DOORSPASSWORD")) "\n"

 


Maybe DXL Security helps here...

Regards, Mathias

 

 


Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS